package com.snail.poker.uitls.excel;

import java.lang.reflect.Field;
import java.util.Comparator;

public class FieldComparator implements Comparator {

	public int compare(Object one, Object two) {
		Field fieldOne = (Field) one;
		Field fieldTwo = (Field) two;
		ExcelAnnotation annoOne = fieldOne.getAnnotation(ExcelAnnotation.class);
		ExcelAnnotation annoTwo = fieldTwo.getAnnotation(ExcelAnnotation.class);
		if (null != annoOne && null != annoTwo) {
			return annoOne.id() - annoTwo.id();
		}
		return 0;
	}
}
